﻿using System;
using System.Data;
using System.Web.UI;

namespace msBsc.WebUi
{
    public partial class wfGoodsView : msBsc.Cls.BPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindControls(); 
                //this.SetContrlValue("txtId", GetFormParam("ID"));
                //ShowData(GetFormParam("ID"));
                ShowData(this.Request.QueryString.Get("ID"));
                //doShowGoodNormsView("", "");
                //msBsc.SvRef.TaobaoIpGet oooo = new SvRef.TaobaoIpGet();
                //oooo.getIp(); 
            }
        }

        private void BindControls()
        {
            if (!IsPostBack)
            {
            }
        }
         
        public DataRow drGoods=null;
        private string strGoodsId = "";
        public string GetHeader()
        {
            return new msBsc.WebUi.Code.QtHtmlGet().GetHeaderShopLogoHtml();
        }
        
        private void loadHeader(string _strDealerId)
        {
            using (msBsc.AppLogic.DataAlc.CBizShpCommercialTenantInfo objtem1 = new AppLogic.DataAlc.CBizShpCommercialTenantInfo())
            {
                string strjsontem1 = objtem1.GetHeadJsonData(_strDealerId, null);// msBsc.AppLogic.Cfg.HttpTools.GetJsonByTable(ds.Tables[0], "", "DATA_TYPE,DATA_TYPE_DESC,DATA_SEQ_NUM,CHILD_LINKS", 1, 1000, "DATA_SEQ_NUM ASC");
                //this.ExecJScript("debugger;");
                this.ExecJScript(@" var data= " + strjsontem1 + @" ; 
                doBoundHeader( data,'" + drGoods["HEADER_TEMPLATE_URL"].ToString() + "');");
            }
            //}
        }

        public string GetPriceHtml()
        {
            System.Text.StringBuilder sbHtml = new System.Text.StringBuilder();
            bool blOld = false;
            if (decimal.Parse(drGoods["GOODS_OLD_PRICE"].ToString() == string.Empty ? "0.00" : drGoods["GOODS_OLD_PRICE"].ToString()) > 0)
            {
                blOld = true;
            }
            string strScorePrive = "";
            if (drGoods["MALL_NO"].ToString() == "1")
            {
                strScorePrive=@"
    <dl class=""tm-promo-panel tm-promo-cur"" id=""J_PromoScore"" data-label=""积分"">
        <dt class=""tb-metatit"">积分换购</dt><dd><div class=""tm-promo-price"">
             <span class=""tm-price"" id=""spnStrikeScore"" style=""font-size: 26px;"">" + drGoods["GOODS_STRIKE_SCORE"].ToString() + @"</span><em class=""tm-yen"">分</em>  &nbsp;&nbsp;
        </div>
            <p>
            </p>
        </dd>
    </dl>";
            }

            sbHtml.Append(@"
    <dl class=""tm-promo-panel tm-promo-cur"" id=""J_PromoPrice"" data-label=""价格"">
        <dt class=""tb-metatit"">价格</dt><dd><div class=""tm-promo-price"">
            <em class=""tm-yen"">￥</em> <span class=""tm-price"" id=""spnStrikePrice"">" + drGoods["GOODS_STRIKE_PRICE"].ToString() + @"</span> <span class=""tm-price-item"" id=""spnStrikePriceDesc"">" + drGoods["PRICE_DESC"].ToString() + @"</span>  &nbsp;&nbsp;
        </div>
            <p>
            </p>
        </dd>
    </dl>
    "+strScorePrive+@"
    <dl class=""tm-price-panel"" id=""J_StrPriceModBox"">
        <dt class=""tb-metatit"">原价</dt>
        <dd>
            <em class=""tm-yen"">￥</em> <span class=""tm-price"" id=""spnOldPrice"">" + drGoods["GOODS_OLD_PRICE"].ToString() + @"</span></dd>
    </dl> ");
            if (!blOld)
            {
                this.ExecJScript("$('#J_StrPriceModBox').hide();");
            }





//            if (drGoods["GOODS_OLD_PRICE"].ToString() != drGoods["GOODS_STRIKE_PRICE"].ToString())
//            {
//                sbHtml.Append(@"
//    <dl class=""tm-promo-panel tm-promo-cur"" id=""J_PromoPrice"" data-label=""价格"">
//        <dt class=""tb-metatit"">价格</dt><dd><div class=""tm-promo-price"">
//            <em class=""tm-yen"">￥</em> <span class=""tm-price"">" + drGoods["GOODS_STRIKE_PRICE"].ToString() + @"</span> <span class=""tm-price-item"">" + drGoods["PRICE_DESC"].ToString() + @"</span>  &nbsp;&nbsp;
//        </div>
//            <p>
//            </p>
//        </dd>
//    </dl>
//    <dl class=""tm-price-panel"" id=""J_StrPriceModBox"">
//        <dt class=""tb-metatit"">原价</dt>
//        <dd>
//            <em class=""tm-yen"">￥</em> <span class=""tm-price"">" + drGoods["GOODS_OLD_PRICE"].ToString() + @"</span></dd>
//    </dl> ");
//            }
//            else
//            {
//                sbHtml.Append(@" 
//    <dl class=""tm-promo-panel tm-promo-cur"" id=""J_PromoPrice"" data-label=""价格"">
//        <dt class=""tb-metatit"">价格</dt><dd><div class=""tm-promo-price"">
//            <em class=""tm-yen"">￥</em> <span class=""tm-price"">" + drGoods["GOODS_STRIKE_PRICE"].ToString() + @"</span>  <span class=""tm-price-item"">" + drGoods["PRICE_DESC"].ToString() + @"</span> &nbsp;&nbsp;
//        </div>
//            <p>
//            </p>
//        </dd>
//    </dl>
//    <dl class=""tm-price-panel"" id=""J_StrPriceModBox"">
//        <dt class=""tb-metatit""></dt>
//        <dd>
//            <em class=""tm-yen""></em> <span class=""tm-price""></span></dd>
//    </dl>  ");
//            }
            return sbHtml.ToString();
        }


//        public string GetFreightHtml()
//        {
//            System.Text.StringBuilder sbHtml = new System.Text.StringBuilder(); 
//                sbHtml.Append(@"
//    <dl class=""tm-delivery-panel"" id=""J_RSPostageCont"">
//        <dt class=""tb-metatit"">运费</dt><dd>
//            <div class=""tb-postAge""> 
//                <div id=""J_PostageToggleCont"" class=""tb-postAge-info"">
//                    <p>
//                        <span>快递: " + drGoods["PRICE_FIRST"].ToString() + @" </span>
//                    </p>
//                </div>
//            </div>
//        </dd>
//    </dl>"); 
//            return sbHtml.ToString();
//        }

        //DataSet dsImg=null;
        public string GetGoodsImgShow()
        {
            string[] arrstrimg = drGoods["IMG_URL_LIST"].ToString().Split(',');
            System.Text.StringBuilder sbHtml = new System.Text.StringBuilder();
            //if (dsImg == null)
            //{
            //    using (msBsc.AppLogic.DataAlc.CBizShpGoodsImg oCDbAccess = new msBsc.AppLogic.DataAlc.CBizShpGoodsImg())
            //    {
            //        dsImg = oCDbAccess.SelectByGoodsId(strGoodsId);
            //    }
            //}
            string strfirstImgUrl = "data:image/png;base64,";
            if (arrstrimg.Length > 0 && arrstrimg[0] != string.Empty)
            {
                strfirstImgUrl = arrstrimg[0];
            }
            sbHtml.Append(@"
    <div class=""tb-booth"">
        <a href=""javascript:void(0);"" rel=""nofollow"" target=""_blank""><span class=""zoomIcon""
            style=""display: none;"">󰄬</span><span class=""ks-imagezoom-wrap""><img id=""J_ImgBooth""
                alt="" "" src=""" + strfirstImgUrl + @" 420x420img.jpg"" width=""420px"" height=""420px""/><span style=""position: absolute; top: 4.5px; left: 0px; width: 147px;
                    height: 147px;display:none;"" class=""ks-imagezoom-lens""></span></span></a>
    </div>
    <ul id=""J_UlThumb"" class=""tb-thumb tm-clear"">");
            for (int i = 0; i < arrstrimg.Length; i++)
            {
                sbHtml.Append(@" <li class=""><a href=""javascript:void(0);""> <img src=""" + arrstrimg[i] + @" 420x420img.jpg""></a></li>");
            }
            sbHtml.Append(@" </ul>");

            return sbHtml.ToString();
        }

        private DataSet dsAttr = null;
        public string GetGoodsAttrList()
        {
            System.Text.StringBuilder sbHtml = new System.Text.StringBuilder();
            if (dsAttr == null)
            {
                using (msBsc.AppLogic.DataAlc.CBizShpGoodsAttribute oCDbAccess = new msBsc.AppLogic.DataAlc.CBizShpGoodsAttribute())
                {
                    dsAttr = oCDbAccess.SelectByGoodsId(strGoodsId);
                }
            }
            //string strfirstImgUrl = "#";
            //if (dsAttr.Tables[0].Rows.Count > 0)
            //{
            //    strfirstImgUrl = dsAttr.Tables[0].Rows[0]["IMG_URL"].ToString();
            //}
            sbHtml.Append(@"
    <div class=""tm-clear tb-hidden tm_brandAttr"" id=""J_BrandAttr"" style=""display: block;"">
        <div class=""name"">
            品牌名称：<a class=""J_EbrandLogo"" target=""_blank"" href=""/c_GoodsSearch.htm?b=" + drGoods["BRAND_ID"].ToString() + @""">" + drGoods["BRAND_NME"].ToString() + (drGoods["BRAND_NME_EN"].ToString() != string.Empty ? "/"+drGoods["BRAND_NME_EN"].ToString() : "") + @"</a></div>
            </div>
    <p class=""attr-list-hd tm-clear"">
        <em>产品参数：</em></p>
    <ul id=""J_AttrUL"">");
            for (int i = 0; i < dsAttr.Tables[0].Rows.Count; i++)
            {
                sbHtml.Append(@"<li title=""&nbsp;" + dsAttr.Tables[0].Rows[i]["ATTRIBUTE_VALUE"].ToString() + @""">" + dsAttr.Tables[0].Rows[i]["ATTRIBUTE_NME"].ToString() + @":&nbsp;" + dsAttr.Tables[0].Rows[i]["ATTRIBUTE_VALUE"].ToString() + @"</li>");
            }
            sbHtml.Append(@" </ul>");

            return sbHtml.ToString();
        }
        public string GetGoodsDescHtml()
        {
            System.Text.StringBuilder sbHtml = new System.Text.StringBuilder();
            sbHtml.Append(@"
<script type=""text/javascript"">  
    function setnviframe1Size() { 
    $('#nviframe1').width($($('#nviframe1')[0].contentWindow.document).width()); 
    $('#nviframe1').height($($('#nviframe1')[0].contentWindow.document).height()); 
    }; 
</script>
<iframe id=""nviframe1"" scrolling=""no""  frameborder=""0"" src=""" + drGoods["GOODS_DESC_URL"].ToString() + @""" style=""width:100%;"" onload=""setnviframe1Size();""></iframe>"); 
            sbHtml.Append(@" </ul>");
             
            return sbHtml.ToString();
        }



//        /// <summary>
//        /// 商品规格
//        /// </summary>
//        private void doShowGoodNormsView(string strGid, string strSelN1, string strSelN2)
//        {
//            using (msBsc.AppLogic.DataAlc.CBizShpGoodsNormsPublic oCDbAccess = new msBsc.AppLogic.DataAlc.CBizShpGoodsNormsPublic())
//            {
//                DataSet ds = oCDbAccess.SelectGoodsNormsForView(strGid, strSelN1, strSelN2);
//                string strjsontem1 = msBsc.AppLogic.Cfg.HttpTools.GetJsonByTable(ds.Tables[0], "", "NORMS_NME,GROUP_N", 1, 100, "");
//                this.ExecJScript(@"var data = " + strjsontem1 + @";
//    var tpl =HtmlUtil.htmlDecode(document.getElementById('norms_list_temp').innerHTML);
//    laytpl(tpl).render(data, function(render){
//        $('#divNormsView').empty().html(render);
//    });
//                ");
//            }
//        }


        private void doShowRecommendList(string strGid)
        {
            using (msBsc.AppLogic.DataAlc.CBizShpGoodsInfo oCDbAccess = new msBsc.AppLogic.DataAlc.CBizShpGoodsInfo())
            {
                string strSql = @"
    SELECT TOP 6
    B.GOODS_ID
    ,B.IMG_URL
    ,B.GOODS_STRIKE_PRICE
    FROM SHP_GOODS_INFO A
    LEFT OUTER JOIN SHP_GOODS_INFO B ON A.COMM_TENANT_ID=B.COMM_TENANT_ID 
						    AND A.CT_LEVEL_ONE_ID=B.CT_LEVEL_ONE_ID  
    WHERE 
    (A.GOODS_ID='" + strGid + @"')
    AND (B.IS_RECOMMEND=1)
    AND (B.IMG_URL<>'') 
    ";
                DataSet ds = oCDbAccess.DataObj.QueryBySQL(strSql);
                string strjsontem1 = msBsc.AppLogic.Cfg.HttpTools.GetJsonByTable(ds.Tables[0], "", "", 1, 100, "");
                this.ExecJScript(@"var data = " + strjsontem1 + @";
    var tpl =HtmlUtil.htmlDecode(document.getElementById('recommend_list_temp').innerHTML);
    laytpl(tpl).render(data, function(render){
        $('#spnrecommendlist').empty().html(render);
    });
                ");
            }
        }


        private void doShowRateGrid(string strGid, string strRateType, string strHasContent
            , string CurrPageNum, string strPageRowsCount, string strSort)
        {
            using (msBsc.AppLogic.DataAlc.CBizShpOrderRate oCDbAccess = new msBsc.AppLogic.DataAlc.CBizShpOrderRate())
            {
                string strSql = @"
    SELECT
    A.*
    ,B.NORMS_DESC
    FROM SHP_ORDER_RATE A
    LEFT OUTER JOIN SHP_ORDER_FORM_LIST B ON A.ORDER_LIST_ID=B.ORDER_LIST_ID
    WHERE
    (A.GOODS_ID='" + strGid + @"')
    ";
                if (strRateType == "追评")
                {
                    strSql += " AND BUYER_RATE_DT2 IS NOT NULL";
                }
                else if (strRateType == "图片")
                {
                    strSql += " AND GOODS_IMG_URL1 IS NOT NULL AND GOODS_IMG_URL1<>''";
                }
                else if (strRateType == "好评")
                {
                    strSql += " AND BUYER_RATE_NUM=1";
                }
                else if (strRateType == "中评")
                {
                    strSql += " AND BUYER_RATE_NUM=0";
                }
                else if (strRateType == "差评")
                {
                    strSql += " AND BUYER_RATE_NUM=-1";
                }
                if (strHasContent == "1")
                {
                    strSql += " AND BUYER_RATE_DESC1<>''";
                }

                DataSet ds = oCDbAccess.DataObj.QueryBySQL(strSql);
                string strjsontem1 = msBsc.AppLogic.Cfg.HttpTools.GetJsonByTable(ds.Tables[0], "", ""
                    , (CurrPageNum == string.Empty ? 1 : int.Parse(CurrPageNum))
                    , (strPageRowsCount == string.Empty ? 20 : int.Parse(strPageRowsCount))
                    , (strSort == string.Empty ? "BUYER_RATE_DT1 DESC" : strSort));
                this.ExecJScript(@" var data= " + strjsontem1 + @" ; 
                updateRateTableHtml( data);");


                DataSet ds2 = oCDbAccess.SelectRateStatistic(strGid);
                if (ds2.Tables[0].Rows.Count > 0)
                {
                    this.ExecJScript("$('#emD2').html('" + ds2.Tables[0].Rows[0]["ZUIP_COUNT"].ToString() + "');");
                    this.ExecJScript("$('#emD3').html('" + ds2.Tables[0].Rows[0]["IMG_COUNT"].ToString() + "');");
                    this.ExecJScript("$('#emD4').html('" + ds2.Tables[0].Rows[0]["HAOP_COUNT"].ToString() + "');");
                    this.ExecJScript("$('#emD5').html('" + ds2.Tables[0].Rows[0]["ZHONGP_COUNT"].ToString() + "');");
                    this.ExecJScript("$('#emD6').html('" + ds2.Tables[0].Rows[0]["CHAP_COUNT"].ToString() + "');");
                }
            }
        }

        private void doShowDealRecordGrid(string strGid
            , string CurrPageNum, string strPageRowsCount, string strSort)
        {
            using (msBsc.AppLogic.DataAlc.CBizShpOrderRate oCDbAccess = new msBsc.AppLogic.DataAlc.CBizShpOrderRate())
            {
                string strSql = @"
    SELECT 
    B.USER_NME
    ,A.NORMS_DESC
    ,A.GOODS_QTY
    ,A.GOODS_STRIKE_PRICE
    ,B.INITIAL_DT
    FROM SHP_ORDER_FORM_LIST A
    LEFT OUTER JOIN SHP_ORDER_FORM B ON A.ORDER_FORM_ID=B.ORDER_FORM_ID
    WHERE
    (A.GOODS_ID='" + strGid + @"')
    AND (B.TRADE_STATUS_TXT='交易成功')";

                DataSet ds = oCDbAccess.DataObj.QueryBySQL(strSql);
                string strjsontem1 = msBsc.AppLogic.Cfg.HttpTools.GetJsonByTable(ds.Tables[0], "", ""
                    , (CurrPageNum == string.Empty ? 1 : int.Parse(CurrPageNum))
                    , (strPageRowsCount == string.Empty ? 20 : int.Parse(strPageRowsCount))
                    , (strSort == string.Empty ? "INITIAL_DT DESC" : strSort));
                this.ExecJScript(@" var data= " + strjsontem1 + @" ; 
                updateDealRdTableHtml( data);");
            }
        }


        private DataSet dsNorms = null;
        public string GetGoodsNormsList()
        {
            if (drGoods["NORMS_COUNT"].ToString() == "1" || drGoods["NORMS_COUNT"].ToString() == "0" || drGoods["NORMS_COUNT"].ToString() == string.Empty)
            {
                return "";
            }
            System.Text.StringBuilder sbHtml1 = new System.Text.StringBuilder();
            System.Text.StringBuilder sbHtml2 = new System.Text.StringBuilder();
            if (dsNorms == null)
            {
                using (msBsc.AppLogic.DataAlc.CBizShpGoodsNormsPublic oCDbAccess = new msBsc.AppLogic.DataAlc.CBizShpGoodsNormsPublic())
                {
                    dsNorms = oCDbAccess.SelectByGoodsId(strGoodsId);
                }
            }
            System.Collections.Generic.List<string> lsNorms1 = new System.Collections.Generic.List<string>();
            System.Collections.Generic.List<string> lsNorms2 = new System.Collections.Generic.List<string>();
            for (int i = 0; i < dsNorms.Tables[0].Rows.Count; i++)
            {
                if (!string.IsNullOrEmpty(dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString()) && !lsNorms1.Contains(dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString()))
                {
                    if (lsNorms1.Count == 0)
                    {
                        sbHtml1.Append(@"
    <dl class=""tb-prop tm-clear"">
    <dt class=""tb-metatit"">" +  drGoods["NORMS_NME1"].ToString()  + @"</dt>
    <dd>
        <ul data-property=""p1"" id=""J_TSaleProp_p1"" class=""tm-clear J_TSaleProp"" sel-data-value="""">");



//                        sbHtml1.Append(@"
//    <dl class=""tb-prop tm-clear"" id=""J_relateGroup1"">
//        <dt class=""tb-metatit"">" + (drGoods["NORMS_NME1"].ToString() != string.Empty ? drGoods["NORMS_NME1"].ToString() : "分类") + @"</dt><dd><ul class=""tm-clear J_TSaleProp"">");
                        sbHtml1.Append(@"<li data-value=""" + dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() + @"""><a href=""javascript:void(0);"" ><span>" + dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() + @"</span></a></li>");
                    }
                    else
                    {
                        sbHtml1.Append(@"<li data-value=""" + dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() + @"""><a href=""javascript:void(0);"" ><span>" + dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() + @"</span></a></li>");
                    }
                    lsNorms1.Add(dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString());
                }

                if (!string.IsNullOrEmpty(dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString()) && !lsNorms2.Contains(dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString()))
                {
                    if (lsNorms2.Count == 0)
                    {
                        sbHtml2.Append(@"
    <dl class=""tb-prop tm-clear"">
    <dt class=""tb-metatit"">" +  drGoods["NORMS_NME2"].ToString()  + @"</dt>
    <dd>
        <ul data-property=""p2"" id=""J_TSaleProp_p2"" class=""tm-clear J_TSaleProp"" sel-data-value="""">");
                        sbHtml2.Append(@"<li data-value=""" + dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() + @"""><a href=""javascript:void(0);"" ><span>" + dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() + @"</span></a></li>");
                    }
                    else
                    {
                        sbHtml2.Append(@"<li data-value=""" + dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() + @"""><a href=""javascript:void(0);"" ><span>" + dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() + @"</span></a></li>");
                    }
                    lsNorms2.Add(dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString());
                }





//                if (i == 0 || i > 0 && dsNorms.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() != dsNorms.Tables[0].Rows[i + 1]["PUB_NORMS_NME1"].ToString())
//                {
//                    seqcount++;
//                    string strSeqtxt = "";
//                    if (seqcount == 1)
//                    {
//                        strSeqtxt = (drGoods["NORMS_NME1"].ToString() != string.Empty ? drGoods["NORMS_NME1"].ToString() : "分类");
//                    }
//                    else if (seqcount == 2)
//                    {
//                        strSeqtxt = (drGoods["NORMS_NME2"].ToString() != string.Empty ? drGoods["NORMS_NME2"].ToString() : "型号");
//                    }
//                    sbHtml.Append(@"
//    <dl class=""tm-relate-wrapper tm-clear"" id=""J_relateGroup"">
//        <dt class=""tb-metatit"">" + strSeqtxt + @"</dt><dd><ul class=""tm-relate-list"">");
//                }

//                sbHtml.Append(@"<li class=""tm-relate-current""><span title=""三段 1kg"">三段 1kg<i class=""icon tm-relate-arrow""></i></span></li>");



//                sbHtml.Append(@"<li title=""&nbsp;" + dsAttr.Tables[0].Rows[i]["ATTRIBUTE_VALUE"].ToString() + @""">" + dsAttr.Tables[0].Rows[i]["ATTRIBUTE_NME"].ToString() + @":&nbsp;" + dsAttr.Tables[0].Rows[i]["ATTRIBUTE_VALUE"].ToString() + @"</li>");
            }
            if (sbHtml1.Length > 0)
            {
                sbHtml1.Append(@"</ul></dd></dl>");
            }
            if (sbHtml2.Length > 0)
            {
                sbHtml2.Append(@"</ul></dd></dl>");
            }


            return sbHtml1.ToString() + sbHtml2.ToString();
        }

        private void AddViewLog()
        {
            using (Epm.AppLogic.Framework.CDbAccess objacc = new Epm.AppLogic.Framework.CDbAccess())
            {
                objacc.ExecuteBySQL("");
            }
        }

        public string GetLookListJs()
        {
            if (drGoods["IMG_URL_LIST"].ToString() == string.Empty)
            {
                return "";
            }
            System.Text.StringBuilder sbHtml = new System.Text.StringBuilder();
            //if (dsImg == null)
            //{
            //    using (msBsc.AppLogic.DataAlc.CBizShpGoodsImg oCDbAccess = new msBsc.AppLogic.DataAlc.CBizShpGoodsImg())
            //    {
            //        dsImg = oCDbAccess.SelectByGoodsId(strGoodsId);
            //    }
            //}
            string[] arrstrimg = drGoods["IMG_URL_LIST"].ToString().Split(',');
            //string strfirstImgUrl = "data:image/png;base64,";
            if (arrstrimg.Length > 0 && arrstrimg[0] != string.Empty)
            {
                //strfirstImgUrl = arrstrimg[0];
                if (!string.IsNullOrEmpty(strGoodsId))
                {
                    sbHtml.Append(@"
<script type=""text/javascript"">  
    var haschg=false;
    for (var i = 0; i < 10; i++) {
        if(LS.get(""CURR_LOOK_ID_"" + i) && LS.get(""CURR_LOOK_ID_"" + i)==""" + strGoodsId + @""")
        {
            haschg=true;
            break;
        }
        else if(!LS.get(""CURR_LOOK_ID_"" + i))
        {
            LS.set(""CURR_LOOK_ID_"" + i, """ + strGoodsId + @""");
            LS.set(""CURR_LOOK_IMG_"" + i, """ + arrstrimg[0] + @""");
            LS.set(""CURR_LOOK_PRICE_"" + i, """ + drGoods["GOODS_STRIKE_PRICE"].ToString() + @"""); 
            haschg=true;
            break;
        }
    } 
    if(!haschg)
    {
        for (var i = 0; i < 9; i++) {
            LS.set(""CURR_LOOK_ID_"" + i,LS.get(""CURR_LOOK_ID_"" + (i+1)));
            LS.set(""CURR_LOOK_IMG_"" + i,LS.get(""CURR_LOOK_IMG_"" + (i+1)));
            LS.set(""CURR_LOOK_PRICE_"" + i,LS.get(""CURR_LOOK_PRICE_"" + (i+1))); 
        }
        LS.set(""CURR_LOOK_ID_"" + 9, """ + strGoodsId + @""");
        LS.set(""CURR_LOOK_IMG_"" + 9, """ + arrstrimg[0] + @""");
        LS.set(""CURR_LOOK_PRICE_"" + 9, """ + drGoods["GOODS_STRIKE_PRICE"].ToString() + @"""); 
    } 
</script>");
                }
            }
            return sbHtml.ToString();
        }


        public string GetContent()
        {
            System.Text.StringBuilder sbHtml = new System.Text.StringBuilder(); 




            return sbHtml.ToString();
        }

        private void ShowData(string strId)
        {
            if (string.IsNullOrEmpty(strId))
            {
                this.ToErrPage("当前浏览的货物不存在，可能已下架！");
                return;
            }
            using (msBsc.AppLogic.DataAlc.CBizShpGoodsInfo oCDbAccess = new msBsc.AppLogic.DataAlc.CBizShpGoodsInfo())
            {
                System.Data.DataSet ds = oCDbAccess.SelectGoodsViewData(strId);
                if (ds.Tables[0].Rows.Count <= 0)
                {
                    this.ToErrPage("当前浏览的货物不存在，可能已下架！");
                    return;
                }
                else
                {
                    drGoods = ds.Tables[0].Rows[0];
                    if (drGoods["GOODS_STATUS_SID"].ToString() != "1")
                    {
                        this.ExecJScript("$('#divErrShow').show();");
                        this.ExecJScript("$('#divsubbtn').hide();");
                    }
                    else
                    {
                        this.ExecJScript("$('#divErrShow').hide();");
                        this.ExecJScript("$('#divsubbtn').show();");
                    }

                    using (msBsc.AppLogic.DataAlc.CBizShpCommercialTenantInfo oshop = new AppLogic.DataAlc.CBizShpCommercialTenantInfo())
                    {
                        string strmsg = oshop.ValitPubGoods(msBsc.SvRef.UserInfo.OperDealerId.Split(',')[0], drGoods["COMM_TENANT_SID"].ToString(), drGoods["DEPOSIT_AMT"].ToString());
                        if (strmsg != string.Empty)
                        {
                            this.ExecJScript("$('#divErrShow').show();");
                            this.ExecJScript("$('#divErrShow').html('" + strmsg + "');");
                            this.ExecJScript("$('#divsubbtn').hide();");
                        }
                    }

                    //if (drGoods["COMM_TENANT_SID"].ToString() == "4")
                    //{
                    //    this.ExecJScript("$('#divErrShow').show();");
                    //    this.ExecJScript("$('#divErrShow').html('该店铺已关闭，不能购买！');");
                    //    this.ExecJScript("$('#divsubbtn').hide();");
                    //} 

                    strGoodsId = strId;
                    this.ExecJScript("$('#txtId').val('" + strGoodsId + "');");
                    this.ExecJScript("$('#txtLogisId').val('" + ds.Tables[0].Rows[0]["LOGISTICS_TEMPLATE_ID"].ToString() + "');");
                    this.ExecJScript("$('#txtDealerId').val('" + ds.Tables[0].Rows[0]["COMM_TENANT_ID"].ToString() + "');");



                    this.ExecJScript("$('#spnRateCount1').html('" + ds.Tables[0].Rows[0]["EVALUATION_COUNT"].ToString() + "');");
                    this.ExecJScript("$('#spnMonthVol1').html('" + ds.Tables[0].Rows[0]["MONTHLY_VOLUME"].ToString() + "');");
                    this.ExecJScript("$('#spnRateCount2').html('" + ds.Tables[0].Rows[0]["EVALUATION_COUNT"].ToString() + "');");
                    this.ExecJScript("$('#spnMonthVol2').html('" + ds.Tables[0].Rows[0]["MONTHLY_VOLUME"].ToString() + "');");

                    //string strtem1 = decimal.Round((decimal)ds.Tables[0].Rows[0]["EVALUATION_AVG"], 1).ToString();
                    //this.ExecJScript("$('#spnRateDesc').html('<span class=\"c-value-no c-value-" + strtem1.Replace(".", "d") + "\"><em>" + strtem1 + "</em></span>" + strtem1 + "');");
                    loadHeader(ds.Tables[0].Rows[0]["COMM_TENANT_ID"].ToString());
                }

                strTotalQty = drGoods["GOODS_QTY"].ToString();

                if (dsNorms == null)
                {
                    using (msBsc.AppLogic.DataAlc.CBizShpGoodsNormsPublic oCDbAccess2 = new msBsc.AppLogic.DataAlc.CBizShpGoodsNormsPublic())
                    {
                        dsNorms = oCDbAccess2.SelectByGoodsId(strGoodsId);
                    }
                }
                int itm222 = 0;
                for (int r = 0; r < dsNorms.Tables[0].Rows.Count; r++)
                {
                    itm222 += (int)dsNorms.Tables[0].Rows[r]["GOODS_QTY"];
                }
                strTotalQty = itm222.ToString();

                System.Transactions.TransactionOptions transactionOption = new System.Transactions.TransactionOptions();
                transactionOption.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                transactionOption.Timeout = new TimeSpan(0, 10, 0);
                using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOption))
                {
                    oCDbAccess.DataObj.ExecuteBySQL("UPDATE SHP_GOODS_INFO SET VIEW_NUM=ISNULL(VIEW_NUM,0)+1 WHERE GOODS_ID='" + strId + "'");
                    ts.Complete();
                }
            }
        }

        public string strTotalQty = "0";

        public string GetShopInfo()
        {
            return @"
    <div class=""shop-intro"">
        <h3 class=""hd"" style="""">
            <div class=""name"">
                <a class=""shopLink"" href=""/c_ShopView.htm?ID=" + drGoods["COMM_TENANT_ID"].ToString() + @""" target=""_blank"">掌柜：" + drGoods["COMM_USER_NME"].ToString() + @"</a></div>
            <i></i>
        </h3>
        <div style=""height: 0px; margin-top: 0px; margin-bottom: 0px; overflow: hidden; width: 126px;"">
        </div>
        <div class=""shop-cert shop-3c"">
            <a class=""icon"" target=""_blank"" href=""/c_ShopView.htm?ID=" + drGoods["COMM_TENANT_ID"].ToString() + @"""></a>
            <div class=""text"" target=""_blank"">
                " + drGoods["COMM_TENANT_NME"].ToString() + @"</div>
        </div>
        <div class=""main-info"" style=""position: relative;"">
            <div class=""shopdsr-item"">
                <div class=""shopdsr-title"">
                    描 述</div>
                <div class=""shopdsr-score shopdsr-score-up-ctrl"">
                    <span class=""shopdsr-score-con"">" + drGoods["DESC_MATCH_RATE"].ToString() + @"</span> <s class=""shopdsr-score-up""></s>
                </div>
            </div>
            <div class=""shopdsr-item"">
                <div class=""shopdsr-title"">
                    服 务</div>
                <div class=""shopdsr-score shopdsr-score-up-ctrl"">
                    <span class=""shopdsr-score-con"">" + drGoods["SERVICE_RATE"].ToString() + @"</span> <s class=""shopdsr-score-up""></s>
                </div>
            </div>
            <div class=""shopdsr-item"">
                <div class=""shopdsr-title"">
                    物 流</div>
                <div class=""shopdsr-score shopdsr-score-up-ctrl"">
                    <span class=""shopdsr-score-con"">" + drGoods["SEND_SPEED"].ToString() + @"</span> <s class=""shopdsr-score-up""></s>
                </div>
            </div>
            <a target=""_blank"" href=""#"" style=""z-index: 1; display: block; position: absolute;
                width: 100%; height: 100%;""></a>
        </div>
        <div class=""btnArea"">
            <a href=""/c_ShopView.htm?ID=" + drGoods["COMM_TENANT_ID"].ToString() + @""" target=""_blank"" class=""enterShop"">进入店铺</a>
<a id=""xshop_collection_href"" href=""javascript:void(0);""  class=""J_PopupTrigger collection xshop_sc J_TDialogTrigger J_TokenSign favShop""  >收藏店铺</a> 
        </div>
    <div style=""clear:both;height:5px;""></div>
    </div>
    <div style=""clear:both;height:5px;""></div>";
        }


        public void GetLogisticsFreight(string strLogisId,string strProvId,string strLogisNme,string strDealerId,string strQty)
        {
            using (Epm.AppLogic.Framework.CDbAccess oCDbAccess = new Epm.AppLogic.Framework.CDbAccess())
            {
                int iSelQty=int.Parse(strQty==string.Empty?"0":strQty);
                int iFirstQty = 0;
                int iAddQty = 0;
                decimal decFirstPrice = 0M;
                decimal decAddPrice = 0M;
                decimal decPrice = 0M;


                if (strProvId == string.Empty)
                {
                    string strClientIp = msBsc.SvRef.IpGet.GetClientIpInt().ToString(); 
                    DataSet ds1 = oCDbAccess.QueryBySQL("SELECT TOP 1 PROVINCE_ID,PROVINCE_NME FROM BSE_IP_TO_CITY WHERE START_IP <=" + strClientIp + " AND END_IP >= " + strClientIp);
                    if (ds1.Tables[0].Rows.Count > 0)
                    {
                        strProvId = ds1.Tables[0].Rows[0]["PROVINCE_ID"].ToString();
                        this.ExecJScript("LS.set('CURR_RECEIPT_PROVINCE_ID','" + strProvId + "')");
                        this.ExecJScript("LS.set('CURR_RECEIPT_PROVINCE_NME','" + ds1.Tables[0].Rows[0]["PROVINCE_NME"].ToString() + "')");
                        this.ExecJScript("$('#spnToProvince').html('" + ds1.Tables[0].Rows[0]["PROVINCE_NME"].ToString() + "'+'<i class=\"mui_addr_icon\">');");
                    }
                    else
                    {
                        strClientIp = msBsc.SvRef.IpSearch.GetAddressWithIP(msBsc.SvRef.IpGet.GetClientIp());
                        ds1 = oCDbAccess.QueryBySQL("SELECT TOP 1 * FROM BSE_PROVINCE WHERE PROVINCE_NME LIKE '%" + strClientIp.TrimStart().Split(' ')[0]+ "%'");
                        if (ds1.Tables[0].Rows.Count > 0)
                        {
                            strProvId = ds1.Tables[0].Rows[0]["PROVINCE_ID"].ToString();
                            this.ExecJScript("LS.set('CURR_RECEIPT_PROVINCE_ID','" + strProvId + "')");
                            this.ExecJScript("LS.set('CURR_RECEIPT_PROVINCE_NME','" + ds1.Tables[0].Rows[0]["PROVINCE_NME"].ToString() + "')");
                            this.ExecJScript("$('#spnToProvince').html('" + ds1.Tables[0].Rows[0]["PROVINCE_NME"].ToString() + "'+'<i class=\"mui_addr_icon\">');");
                        }
                    }
                }
                if (strProvId == string.Empty)
                {
                    strProvId = "0";
                }




                if (!string.IsNullOrEmpty(strLogisId))
                {
                    DataSet ds = oCDbAccess.QueryBySQL("SELECT TOP 1 QTY_FIRST,PRICE_FIRST,QTY_ADD,PRICE_ADD FROM SHP_COMMERCIAL_LOGISTICS_ZONE WHERE LOGISTICS_TEMPLATE_ID='" + strLogisId + "'   ORDER BY (CASE WHEN PROVINCE_ID='" + strProvId + "' THEN 1 ELSE 0 END) DESC");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        iFirstQty = (int)ds.Tables[0].Rows[0]["QTY_FIRST"];
                        iAddQty = (int)ds.Tables[0].Rows[0]["QTY_ADD"];
                        decFirstPrice = (decimal)ds.Tables[0].Rows[0]["PRICE_FIRST"];
                        decAddPrice = (decimal)ds.Tables[0].Rows[0]["PRICE_ADD"];
                    }
                }



                //else
                //{

                //    DataSet ds = oCDbAccess.QueryBySQL("SELECT TOP 1 A.LOGISTICS_TEMPLATE_ID,A.QTY_FIRST,A.PRICE_FIRST,A.QTY_ADD,A.PRICE_ADD FROM SHP_COMMERCIAL_LOGISTICS A LEFT OUTER JOIN SHP_COMMERCIAL_LOGISTICS_ZONE B ON A.LOGISTICS_TEMPLATE_ID=B.LOGISTICS_TEMPLATE_ID WHERE A.COMM_TENANT_ID='" + strDealerId + "' AND A.TEMPLATE_NME='" + strLogisNme + "' ORDER BY (CASE WHEN B.PROVINCE_ID='" + strProvId + "' THEN 1 ELSE 0 END) DESC");
                //    if (ds.Tables[0].Rows.Count > 0)
                //    {
                //        iFirstQty = (int)ds.Tables[0].Rows[0]["QTY_FIRST"];
                //        iAddQty = (int)ds.Tables[0].Rows[0]["QTY_ADD"];
                //        decFirstPrice = (decimal)ds.Tables[0].Rows[0]["PRICE_FIRST"];
                //        decAddPrice = (decimal)ds.Tables[0].Rows[0]["PRICE_ADD"];
                //        this.ExecJScript("$('#txtLogisId').val('" + ds.Tables[0].Rows[0]["LOGISTICS_TEMPLATE_ID"].ToString() + "');");
                //    }
                //}

                if (iSelQty > iFirstQty && iAddQty > 0 && decAddPrice>0)
                {
                    decPrice = decFirstPrice + (decAddPrice * ((iSelQty - iFirstQty) / iAddQty) + 1);
                }
                else
                {
                    decPrice = decFirstPrice;
                }
                this.ExecJScript("$('#spnLogisticsFreight').html('" + decimal.Round(decPrice,2).ToString() + "');");
                this.ExecJScript("$('#J_RSPostageCont').show();");
                this.ExecJScript("$('#J_RSPostageCont').next().hide();");
            }
        }

        //private void GetStaticInfo(string strId)
        //{
        //    using (msBsc.AppLogic.DataAlc.CBizShpGoodsInfo ogoods = new AppLogic.DataAlc.CBizShpGoodsInfo())
        //    {
        //        DataSet ds = ogoods.SelectGoodStaticsInfo(strId);
        //        if (ds.Tables[0].Rows.Count > 0)
        //        {
        //            this.ExecJScript("$('#spnRateCount1').html('" + ds.Tables[0].Rows[0]["EVALUATION_COUNT"].ToString() + "');");
        //            this.ExecJScript("$('#spnMonthVol1').html('" + ds.Tables[0].Rows[0]["MONTHLY_VOLUME"].ToString() + "');");
        //            this.ExecJScript("$('#spnRateCount2').html('" + ds.Tables[0].Rows[0]["EVALUATION_COUNT"].ToString() + "');");
        //            this.ExecJScript("$('#spnMonthVol2').html('" + ds.Tables[0].Rows[0]["MONTHLY_VOLUME"].ToString() + "');");

        //            string strtem1 = decimal.Round((decimal)ds.Tables[0].Rows[0]["EVALUATION_AVG"],1).ToString();
        //            this.ExecJScript("$('#spnRateDesc').html('<span class=\"c-value-no c-value-" + strtem1.Replace(".", "d") + "\"><em>" + strtem1 + "</em></span>" + strtem1 + "');");

        //        }
        //    }
        //    using (msBsc.AppLogic.DataAlc.CBizShpCommercialTenantInfo ogoods = new AppLogic.DataAlc.CBizShpCommercialTenantInfo())
        //    {
        //        //DataSet ds = ogoods.SelectShopStaticsInfo(strId);
        //        //if (ds.Tables[0].Rows.Count > 0)
        //        //{
        //        //    //this.ExecJScript("$('#spnRateCount1').html('" + ds.Tables[0].Rows[0]["EVALUATION_COUNT"].ToString() + "');");
        //        //    //this.ExecJScript("$('#spnMonthVol1').html('" + ds.Tables[0].Rows[0]["MONTHLY_VOLUME"].ToString() + "');");
        //        //    //this.ExecJScript("$('#spnRateCount2').html('" + ds.Tables[0].Rows[0]["EVALUATION_COUNT"].ToString() + "');");
        //        //    //this.ExecJScript("$('#spnMonthVol2').html('" + ds.Tables[0].Rows[0]["MONTHLY_VOLUME"].ToString() + "');");

        //        //    //string strtem1 = decimal.Round((decimal)ds.Tables[0].Rows[0]["EVALUATION_AVG"],1).ToString();
        //        //    //this.ExecJScript("$('#spnRateDesc').html('<span class=\"c-value-no c-value-" + strtem1.Replace(".", "d") + "\"><em>" + strtem1 + "</em></span>" + strtem1 + "');");

        //        //}
        //    }
        //}

        private void doupdateqtyprice(string strLogisId,string strGid,   string strSelP1,   string strSelP2,  string strQty)
        {
            using (msBsc.AppLogic.DataAlc.CBizShpGoodsNormsPublic objnorms = new AppLogic.DataAlc.CBizShpGoodsNormsPublic())
            {
                int iSelQty = int.Parse(strQty == string.Empty ? "0" : strQty);

                //if (strSelP1 != string.Empty &&strSelP2!=string.Empty)
                //{
                    //DataSet ds = objnorms.DataObj.QueryBySQL("SELECT * FROM SHP_GOODS_NORMS_PUBLIC A WHERE A.GOODS_ID='" + strGid + "' AND (A.PUB_NORMS_NME1='" + strSelP1 + "' OR A.PUB_NORMS_NME2='" + strSelP2 + "' OR A.GOODS_QTY<=0)");

                    DataSet ds = objnorms.DataObj.QueryBySQL("SELECT * FROM SHP_GOODS_NORMS_PUBLIC A WHERE A.GOODS_ID='" + strGid + "'  ");
                    bool blHasSel = false;
                    bool blHasP1 = false;
                    bool blHasP2 = false;
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        if (ds.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() != string.Empty)
                        {
                            blHasP1 = true;
                        }
                        if (ds.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() != string.Empty)
                        {
                            blHasP2 = true;
                        }
                        if (ds.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() == strSelP1
                            && ds.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() == strSelP2)
                        {
                            this.ExecJScript("$('#spnStrikePrice').html('" + ds.Tables[0].Rows[i]["GOODS_STRIKE_PRICE"].ToString() + "');");
                            this.ExecJScript("$('#spnOldPrice').html('" + ds.Tables[0].Rows[i]["GOODS_OLD_PRICE"].ToString() + "');");
                            this.ExecJScript("$('#J_EmStock').html('" + ds.Tables[0].Rows[i]["GOODS_QTY"].ToString() + "');");
                            if (iSelQty > (int)ds.Tables[0].Rows[i]["GOODS_QTY"])
                            {
                                this.ExecJScript("$('#J_Amount input').val('" + ds.Tables[0].Rows[i]["GOODS_QTY"].ToString() + "');");
                            }
                            blHasSel = true;
                        }
                    }
                //if (strSelP1 == string.Empty)
                    //{
                    //    this.ExecJScript("$('#J_TSaleProp_p1 li').removeClass('tb-out-of-stock').addClass('tb-out-of-stock');");
                    //}
                    //if (strSelP2 == string.Empty)
                    //{
                    //    this.ExecJScript("$('#J_TSaleProp_p2 li').removeClass('tb-out-of-stock').addClass('tb-out-of-stock');");
                    //}
                    //this.ExecJScript("$('#divNormsView .J_TSaleProp li').removeClass('tb-out-of-stock').addClass('tb-out-of-stock');");
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //有P1无P2时锁定
                        if (blHasP1 && !blHasP2)
                        {
                            if ((int)ds.Tables[0].Rows[i]["GOODS_QTY"] <= 0)
                            {
                                this.ExecJScript("setnormslist('1','" + ds.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() + "',true);");
                            }
                        }
                        else if (blHasP2 && !blHasP1)
                        {
                            if ((int)ds.Tables[0].Rows[i]["GOODS_QTY"] <= 0)
                            {
                                this.ExecJScript("setnormslist('2','" + ds.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() + "',true);");
                            }
                        }
                        else
                        {
                            if (strSelP1 != string.Empty && strSelP2==string.Empty)
                            {
                                if (i == 0)
                                {
                                    this.ExecJScript("$('#J_TSaleProp_p2 li').removeClass('tb-out-of-stock').addClass('tb-out-of-stock');");
                                }

                                if (ds.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() == strSelP1 && (int)ds.Tables[0].Rows[i]["GOODS_QTY"] > 0)
                                {
                                    this.ExecJScript("setnormslist('2','" + ds.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() + "',false);");
                                }
                            }
                            else if (strSelP2 != string.Empty && strSelP1 == string.Empty)
                            {
                                if (i == 0)
                                {
                                    this.ExecJScript("$('#J_TSaleProp_p1 li').removeClass('tb-out-of-stock').addClass('tb-out-of-stock');");
                                }

                                if (ds.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() == strSelP2 && (int)ds.Tables[0].Rows[i]["GOODS_QTY"] > 0)
                                {
                                    this.ExecJScript("setnormslist('1','" + ds.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() + "',false);");
                                }
                            }
                            else
                            {
                                if (i == 0)
                                {
                                    this.ExecJScript("$('#J_TSaleProp_p1 li').removeClass('tb-out-of-stock').addClass('tb-out-of-stock');");
                                    this.ExecJScript("$('#J_TSaleProp_p2 li').removeClass('tb-out-of-stock').addClass('tb-out-of-stock');");
                                }
                                if (ds.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() == strSelP1 && (int)ds.Tables[0].Rows[i]["GOODS_QTY"] > 0)
                                {
                                    this.ExecJScript("setnormslist('2','" + ds.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() + "',false);");
                                }
                                if (ds.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() == strSelP2 && (int)ds.Tables[0].Rows[i]["GOODS_QTY"] > 0)
                                {
                                    this.ExecJScript("setnormslist('1','" + ds.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() + "',false);");
                                }
                            }

                        }

                         
                    }
                    //if (!blHasSel)
                    //{
                    //    //验证完成选择
                    //    if ((!blHasP1 || blHasP1 && strSelP1 != string.Empty)
                    //        && (!blHasP2 || blHasP2 && strSelP2 != string.Empty))
                    //    {
                    //        //this.ExecJScript("$('#J_TSaleProp_p1 .tb-selected').removeClass('tb-selected');");
                    //        //this.ExecJScript("$('#J_TSaleProp_p2 .tb-selected').removeClass('tb-selected');");
                    //    }
                    //}
                //}
                //else if (strSelP1 != string.Empty)
                //{
                //    DataSet ds = objnorms.DataObj.QueryBySQL("SELECT * FROM SHP_GOODS_NORMS_PUBLIC A WHERE A.GOODS_ID='" + strGid + "' AND (A.PUB_NORMS_NME1='" + strSelP1 + "'  OR A.GOODS_QTY<=0)");

                //    this.ExecJScript("$('#J_TSaleProp_p2 li').removeClass('tb-out-of-stock').addClass('tb-out-of-stock');");
                //    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                //    {
                //        if (ds.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() == strSelP1
                //            && ds.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() == strSelP2)
                //        {
                //            this.ExecJScript("$('#spnStrikePrice').html('" + ds.Tables[0].Rows[i]["GOODS_STRIKE_PRICE"].ToString() + "');");
                //            this.ExecJScript("$('#spnOldPrice').html('" + ds.Tables[0].Rows[i]["GOODS_OLD_PRICE"].ToString() + "');");
                //            this.ExecJScript("$('#J_EmStock').html('" + ds.Tables[0].Rows[i]["GOODS_QTY"].ToString() + "');");
                //            if (iSelQty > (int)ds.Tables[0].Rows[i]["GOODS_QTY"])
                //            {
                //                this.ExecJScript("$('#J_Amount input').val('" + ds.Tables[0].Rows[i]["GOODS_QTY"].ToString() + "');");
                //            }
                //        }
                //        if (ds.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() != string.Empty)
                //        {
                //            this.ExecJScript("setnormslist('2','" + ds.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() + "',false);");
                //        }
                         
                //    }
                //}
                //else
                //{
                //    DataSet ds = objnorms.DataObj.QueryBySQL("SELECT * FROM SHP_GOODS_NORMS_PUBLIC A WHERE A.GOODS_ID='" + strGid + "' AND (A.PUB_NORMS_NME1='" + strSelP1 + "'  OR A.GOODS_QTY<=0)");

                //    this.ExecJScript("$('#J_TSaleProp_p1 li').removeClass('tb-out-of-stock').addClass('tb-out-of-stock');");
                //    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                //    {
                //        if (ds.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() == strSelP1
                //            && ds.Tables[0].Rows[i]["PUB_NORMS_NME2"].ToString() == strSelP2)
                //        {
                //            this.ExecJScript("$('#spnStrikePrice').html('" + ds.Tables[0].Rows[i]["GOODS_STRIKE_PRICE"].ToString() + "');");
                //            this.ExecJScript("$('#spnOldPrice').html('" + ds.Tables[0].Rows[i]["GOODS_OLD_PRICE"].ToString() + "');");
                //            this.ExecJScript("$('#J_EmStock').html('" + ds.Tables[0].Rows[i]["GOODS_QTY"].ToString() + "');");
                //            if (iSelQty > (int)ds.Tables[0].Rows[i]["GOODS_QTY"])
                //            {
                //                this.ExecJScript("$('#J_Amount input').val('" + ds.Tables[0].Rows[i]["GOODS_QTY"].ToString() + "');");
                //            }
                //        }
                //        if (ds.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() != string.Empty)
                //        {
                //            this.ExecJScript("setnormslist('1','" + ds.Tables[0].Rows[i]["PUB_NORMS_NME1"].ToString() + "',false);");
                //        }

                //    }
                //}



            }


            //doShowGoodNormsView(strGid,strSelP1, strSelP2);
            //if ((strHasP1 != "1" || strHasP1 == "1" && strSelP1 != string.Empty)
            //    && (strHasP2 != "1" || strHasP2 == "1" && strSelP2 != string.Empty))
            //{

            //}
        }

        public override void DoAction()
        {
            if (this.strAction == "getAll")
            {
                GetLogisticsFreight(this.GetParamHtValue("LOGIS_ID"), this.GetParamHtValue("TO_PROV_ID"), this.GetParamHtValue("LOGIS_NME"), this.GetParamHtValue("DEALER_ID"), this.GetParamHtValue("SEL_QTY"));
                //GetStaticInfo(this.GetParamHtValue("ID"));
                doShowRecommendList(this.GetParamHtValue("ID"));

            }
            else if (this.strAction == "doupdateqtyprice")
            {
                doupdateqtyprice(this.GetParamHtValue("LOGIS_ID"), this.GetParamHtValue("ID"),  this.GetParamHtValue("SEL_p1"), this.GetParamHtValue("SEL_p2"), this.GetParamHtValue("SEL_QTY"));
            }
            else if (this.strAction == "doFinderRateList")
            {
                doShowRateGrid(this.GetParamHtValue("ID")
                    , this.GetParamHtValue("FINDER_TYPE")
                    , this.GetParamHtValue("HAS_CONTENT")
                    , this.GetParamHtValue("NEW_PAGE_NUM")
                    , this.GetParamHtValue("PAGE_ROW_COUNT")
                    , this.GetParamHtValue("PAGE_ROW_SORT"));
            }
            else if (this.strAction == "doFinderBuyerList")
            {
                doShowDealRecordGrid(this.GetParamHtValue("ID") 
                    , this.GetParamHtValue("NEW_PAGE_NUM")
                    , this.GetParamHtValue("PAGE_ROW_COUNT")
                    , this.GetParamHtValue("PAGE_ROW_SORT"));
            }
        }


        //public string GetContentHtml(string strpId)
        //{
        //    DataSet dstem1 = this.SelectNoticeForView(strpId);
        //    if (dstem1.Tables[0].Rows.Count <= 0)
        //    {
        //        return "";
        //    }
        //    DataRow drtm1 = dstem1.Tables[0].Rows[0];
        //    string strVpathtem1 = dstem1.Tables[0].Rows[0]["CONTENT_V_PATH"].ToString();
        //    //string strpathtem1 = msFws.AppLogic.Cfg.ApplicationConst.Const.GetSaveUploadSysFileDir(strVpathtem1);
        //    //string strContent1 = "";
        //    //System.IO.FileStream fs = new System.IO.FileStream(strpathtem1, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Read);
        //    //System.IO.StreamReader sr = new System.IO.StreamReader(fs, Encoding.Default);
        //    //strContent1 = sr.ReadToEnd();
        //    //sr.Close();
        //    //fs.Close();

        //    CBizSysFile objtem2 = new CBizSysFile();
        //    string strAtenttem1 = "";
        //    strAtenttem1 = objtem2.GetAtachmentHtml(strpId);

        //    string strRettm1 = "";
        //    strRettm1 += "<script type=\"text/javascript\">";
        //    strRettm1 += "function setnviframe1Size() {";
        //    strRettm1 += "$('#nviframe1').width($($('#nviframe1')[0].contentWindow.document).width());";
        //    strRettm1 += "$('#nviframe1').height($($('#nviframe1')[0].contentWindow.document).height());";
        //    strRettm1 += "};";
        //    strRettm1 += "</script>";

        //    strRettm1 += "<div style=\"padding: 15px 35px 0px 35px;\">";
        //    strRettm1 += "    <div style=\"height: 30px;\">";
        //    strRettm1 += "        <h2 style=\"text-align: center; font-size: 18px;\">";
        //    strRettm1 += "            <span>" + drtm1["NOTICE_TITLE"].ToString() + "</span>";
        //    strRettm1 += "        </h2>";
        //    strRettm1 += "    </div>";
        //    strRettm1 += "    <div style=\"border-bottom: 1px solid #eb6100; text-align: right; padding-bottom: 5px;\">";
        //    strRettm1 += "        <div style=\"margin-right: 20px;\">";
        //    strRettm1 += "            [ " + drtm1["NOTICE_TYPE_CID_TXT"].ToString() + " ] [ " + drtm1["PUBLIC_DT"].ToString() + " ]";
        //    strRettm1 += "        </div>";
        //    strRettm1 += "    </div>";
        //    strRettm1 += "    <div>";
        //    strRettm1 += strAtenttem1;
        //    strRettm1 += "    </div>";
        //    strRettm1 += "    <div style=\"padding-top: 2px;\">";
        //    strRettm1 += "        <iframe id=\"nviframe1\" scrolling=\"no\"  frameborder=\"0\" src=\"" + msFws.AppLogic.Cfg.SystemFileDir.FileDir.httpUrlBase.Replace("/fol", "/fws") + strVpathtem1 + "\" style=\"width:100%;\" onload=\"setnviframe1Size();\">";
        //    strRettm1 += "        </iframe>";
        //    strRettm1 += "    </div>";
        //    strRettm1 += "    <div>";
        //    strRettm1 += strAtenttem1;
        //    strRettm1 += "    </div>";
        //    strRettm1 += "</div>";

        //    return strRettm1;
        //}
        //public override void DoAction()
        //{
        //    if (this.strAction == "ShowData")
        //    { 
        //    }
        //}
         
    }
}